package com.shuyu.flutter_plugin_platfromview;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;

/** FlutterPluginPlatfromviewPlugin */
public class FlutterPluginPlatfromviewPlugin implements MethodCallHandler {
  /** Plugin registration. */
  public static void registerWith(Registrar registrar) {
    final MethodChannel channel = new MethodChannel(registrar.messenger(), "plugins/platforview_indicator");

    registrar
            .platformViewRegistry()
            .registerViewFactory(
                    "plugins/platforview_indicator",
                    new FlutterActivityIndicatorFactory(registrar.messenger(), registrar.view()));
    channel.setMethodCallHandler(new FlutterPluginPlatfromviewPlugin());
  }

  @Override
  public void onMethodCall(MethodCall call, Result result) {
    if (call.method.equals("getPlatformVersion")) {
      result.success("Android " + android.os.Build.VERSION.RELEASE);
    } else {
      result.notImplemented();
    }
  }
}
